#include <iostream>
#include "contacts.pb.h"
using namespace std;
int main()
{
    contacts::contact contact;
    contact.set_name("MengHao");
    contact.set_age(22);
    string str = contact.SerializeAsString();
    cout << "序列化结果为: " << str << endl;
    contacts::contact tmp;
    tmp.ParseFromString(str);
    cout << "姓名： " << tmp.name() << endl;
    cout << "年龄： " << tmp.age() << endl;
    return 0;
}